//
//  UIViewController+Category.swift
//  Exchange
//
//  Created by 孟祥群 on 2018/5/5.
//  Copyright © 2018年 common. All rights reserved.
//

import UIKit
extension UIViewController {
    func findHairlineImageViewUnder(view:UIView) -> UIImageView? {
        if view.isKind(of: UIImageView.self) && view.bounds.size.height <= 1.0{
            return view as? UIImageView
        }
        
        for  subview in view.subviews {
            let imageView = self.findHairlineImageViewUnder(view: subview)
            if imageView != nil {
                return imageView
            }
        }
        return nil
    }
    
    
    func hiddenNavgationBarLine(hidden:Bool) {
        let navBarHairlineImageView = self.findHairlineImageViewUnder(view: (self.navigationController?.navigationBar)!)
        navBarHairlineImageView?.isHidden = hidden
    }
}
